package cn.compose.online.constant;

/**
 * @ClassName GroovyConstants
 * @Description 类描述
 * @Author hgm
 * @Date 2021/12/11 17:08
 * @Version 1.0
 **/
public class GroovyConstants {

    public static String typeGenerate = "generate";
    public static String typeRun = "run";
    public static String codeRedisKey = "groovy_history:";

    public static String code ="class Geet{\n" +
            "    public String execute(Map<String, String[]> map) {\n" +
            "    long rsv46=1432778;\n" +
            "    def rsvField46= rsv46;\n" +
            "    //def rsvField46= N_5332_1.rsv46;\n" +
            "    if(rsvField46==null){\n" +
            "        return null;\n" +
            "    }\n" +
            "    //接收到数字类型数据，默认都是10进制数据，多字段组合时需转换为16进制组合\n" +
            "\n" +
            "    //转换位16进制进行取位---rsvField46为十进制数据\n" +
            "    String str46=String.format(\"%06X\",rsvField46);\n" +
            "    StringBuilder stringBuilder=new StringBuilder();\n" +
            "    String character = \".\";\n" +
            "    // 取位组合 - 取位后的数据需将16进制数据转为10进制组合显示\n" +
            "    stringBuilder.append(new BigInteger(str46.substring(0,2),16).intValue())\n" +
            "    .append(character)\n" +
            "    .append(new BigInteger(str46.substring(2,4),16).intValue())\n" +
            "    .append(character)\n" +
            "    .append(new BigInteger(str46.substring(4,6),16).intValue())\n" +
            "\n" +
            "    String result10=stringBuilder.toString();\n" +
            "    println(\"rsv46-10进制: \"+result10)\n" +
            "    return result10;\n" +
            "}\n" +
            "}";
}
